﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Student
    {
        public Student(int num,string name,int age)
        {
            this.Num = num;
            this.Name = name;
            this.Age = age;
        }
        public Student(){}
        public int Num { get; set; }
        public string Name { get; set; }
        public int Age { get; set; }
        public static  void HHHH(ref List<Student> list) 
        {
            Console.WriteLine("请输入添加的学号");
            int num = int.Parse(Console.ReadLine());
            Boolean boo = false;
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].Num == num)
                {
                    boo = true;
                }
            }
            if (boo)
            {
                Console.WriteLine("已存在该学号");
            }
            else
            {
                Console.WriteLine("请输入添加的姓名");
                string name = Console.ReadLine();
                Console.WriteLine("请输入添加的年龄");
                int age = int.Parse(Console.ReadLine());
                Student stu6 = new Student(num, name, age);
                list.Add(stu6);
                Console.WriteLine("添加完毕！！");
            }
        }
        public static void GGGZ(ref List<Student> list) 
        {
            Console.WriteLine("你要删除第几个学生：");
            int e = int.Parse(Console.ReadLine());
            list.RemoveAt(e - 1);
            Console.WriteLine("删除完毕！！");
        }
        public static void SSSS() 
        {

        }
    }
    class Num : IComparer<Student>
    {
        public int Compare(Student x, Student y)
        {
            return x.Num.CompareTo(y.Num);
        }
    }
    class Name : IComparer<Student>
    {
        public int Compare(Student x, Student y)
        {
            return x.Name.CompareTo(y.Name);
        }
    }
    class Age : IComparer<Student>
    {
        public int Compare(Student x, Student y)
        {
            return x.Age.CompareTo(y.Age);
        }
    }
}
